//
//  PushProductsHandle.swift
//  weile
//
//  Created by LKM on 16/11/2.
//  Copyright © 2016年 LKM. All rights reserved.
//

import UIKit
import SwiftyJSON

class PushProductsHandle: NSObject, PushHandleAble  {
    
    override init() {
        
    }
    func toData(forJSONWrap: [String: JSON]?) -> Any {
        return PushProductsTo.init(jsons: forJSONWrap)
    }
    //来到这里肯定是有视图的
    func handler(data: Any) {
        let o = data as? PushProductsTo;
        
        var mainId = ""
        
        //一定会有mainId  而且mainId是有意义的值。不会是0的
        if let mid = o?.mainId {
            mainId=String(mid);
        }
        
        ActivityRequest.presentNavBarWarp(ActivityRequest.AppRootViewController()!, ActivityRequest.getSearchViewController(keyWord: o?.keyword ?? "",productsMainId :mainId ), false);
        
//        ActivityRequest.goSearchViewController(ActivityRequest.AppRootViewController() as! UINavigationController, keyWord: )
//        (url:o.url ?? "",AppDelegate.getInstance().window!.rootViewController! )
        
        //        AppDelegate.getInstance().window!.rootViewController.con
    }
}
